package com.project.bookstore.search;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Document(indexName = "items")
public class BookSearch implements Serializable{

    @Id
    private Long id;   //图书id
    @Field(type = FieldType.Keyword)
    private String classify;  //分类
    @Field(type = FieldType.Text,
            analyzer = "ik_max_word",
            searchAnalyzer = "ik_max_word")
    private String bookName;  //书名
    @Field(type = FieldType.Keyword)
    private String author;   //作者
    @Field(type = FieldType.Double)
    private Double price;   //价格
    @Field(type = FieldType.Keyword, index = false)
    private String picture;   // 图片地址

}
